<template>
    <div class="app-container">
        <el-row :gutter="20">
            <!--专病数据-->
            <el-form class="formBox formBox1" :model="queryParams" ref="queryForm" size="small" :inline="true"
                v-show="showSearch" label-width="68px">
                <el-form-item label="选择时间">
                    <el-date-picker v-model="dateRange" style="width: 200px;margin-right:10px;"
                        value-format="yyyy-MM-dd" type="daterange" size="mini" range-separator="-" :picker-options="pickerOptions"
                        start-placeholder="开始日期" end-placeholder="结束日期" @change="handleQuery"
                        :clearable="false"></el-date-picker>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                    <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                    <!-- <el-button icon="el-icon-printer" size="mini" @click="resetQuery">打印</el-button> -->
                </el-form-item>
            </el-form>
            <div class="formBox">
              
                <el-table border v-loading="loading" :data="tableLists">
                    <!--                <el-table-column type="selection" width="50" align="center" />-->
                    <el-table-column label="序号" align="center" type="index" width="50">
                        <template slot-scope="scope">
                            <span>{{ getIndex(scope.$index) }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="编号" align="center" prop="deptId" :show-overflow-tooltip="true"
                        style="width:300px;" />
                    <el-table-column label="医院名称" align="center" prop="deptName" :show-overflow-tooltip="true"
                        style="width:300px;" />
                    <el-table-column label="医院性质" align="center" prop="nature" :show-overflow-tooltip="true"
                        width="100">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_hospital_nature" :value="scope.row.nature" />
                        </template>
                    </el-table-column>


                    <el-table-column label="医院级别" align="center" prop="level" :show-overflow-tooltip="true">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_hospital_level" :value="scope.row.level" />
                        </template>
                    </el-table-column>
                  

                    <el-table-column label="入驻时间" align="center" prop="createTime" :show-overflow-tooltip="true">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.createTime) }}</span>
                        </template>
                    </el-table-column>

    
                </el-table>
                <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
                    :limit.sync="queryParams.pageSize" @pagination="getList" />
            </div>

        </el-row>

       



    </div>
</template>

<script>
import { statisticsgetAllHospital } from "@/api/system/specialCom";
export default {
    name: "hospitalSum",
    dicts: [
        'sys_hospital_nature',
        'sys_hospital_level'
    ],
    components: {  },
    data() {
        return {
            pickerOptions: {
                shortcuts: [{
                    text: '今天',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '昨天',
                    onClick(picker) {
                        const date = new Date();
                        date.setTime(date.getTime() - 3600 * 1000 * 24);
                        const end = date;
                        const start = date;
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '前天',
                    onClick(picker) {
                        const date = new Date();
                        date.setTime(date.getTime() - 3600 * 1000 * 24 * 2);
                        const end = date;
                        const start = date;
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近一周',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近一个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近三个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近六个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 180);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近1年',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
                        picker.$emit('pick', [start, end]);
                    }
                }]
            },
            loading: true,
         
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
           
            // 日期范围
            dateRange: [],
          
            // 表单参数
            // form: {},
            form: {
              
            },
            tableLists:[],
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
               
            },
           



        };
    },
    watch: {},
    async created() {

        this.getList()
    },
    computed: {

    },
    methods: {
      
      
      



        // 真实序号计算（计算分页影响）
        getIndex(index) {
            return (this.queryParams.pageNum - 1) * this.queryParams.pageNum + index + 1;
        },
        /** 查询设备列表 */
        getList() {
            let that = this
            that.loading = true;
            let params = {
                startTime: that.dateRange[0],
                endTime: that.dateRange[1],
                ...that.queryParams
            }
            statisticsgetAllHospital(params).then((response) => {
                if (response.code == 200) {
                    let data = response.data;
                    console.log(data)
                    that.tableLists = data
                }

                that.loading = false;
            });
          
        },
        // 取消按钮
        cancel() {
           
        },

        // 表单重置
        reset() {
        
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.dateRange = [];
            this.resetForm("queryForm");
            this.handleQuery();
        },

        

    },
};
</script>
<style scoped>

</style>
